/**
 * Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 *
 * For the applicable distribution terms see the license.txt -file, included in
 * the distribution.
 */

#ifndef AUDIOPLAYER_H
#define AUDIOPLAYER_H

#include <QObject>
#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5)
    #include <QSystemDeviceInfo>
    QTM_USE_NAMESPACE
#endif
#include "GEAudio/GEAudioOut.h"
#include "GEAudio/GEAudioMixer.h"
#include "GEAudio/GEAudioBufferPlayInstance.h"

class AudioPlayer : public QObject
{
    Q_OBJECT

private:
    GE::AudioOut *audioOut;
    GE::AudioBufferPlayInstance *playInstance;
    GE::AudioMixer *mixer;
    bool silent;
    bool playing;

public:
    explicit AudioPlayer(QObject *parent = 0);

signals:

public slots:
    void setSpeed(qreal);
    void stop();
    void start();
#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5)
    void profile(QSystemDeviceInfo::Profile profile) {
        if (profile == QSystemDeviceInfo::SilentProfile) {
            silent = true;
            playInstance->setLeftVolume(0);
            playInstance->setRightVolume(0);
        }
        else {
            silent = false;
            if (playing) {
                playInstance->setLeftVolume(1);
                playInstance->setRightVolume(1);
            }
        }
    }
#endif
};

#endif // AUDIOPLAYER_H
